import { request } from "@/utils/http";
import type {
  getHosListSearchParamsType,
  hospitalListReqReturnType,
  ProvinceReturnAryType,
  HospitalDetailsType,
  getPageListType,
  getTimeType,
  fourDateType,
  accordingToTime,
  accordingToTimeType,
} from "./model/hospitalListTypes";
// hoscode, hosname, hostype, provinceCode, cityCode, districtCode, status
//1.获取医院列表数据的请求
export const getHospitalListRequest = (
  page: number,
  limit: number,
  searchParams: getHosListSearchParamsType
) => {
  return request.get<any, hospitalListReqReturnType>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: searchParams,
    }
  );
};
// 2.请求所有的省份
export const ProvinceTypeRequest = () => {
  return request.get<any, ProvinceReturnAryType>(
    "/admin/cmn/dict/findByDictCode/province"
  );
};
// 3.请求市或者区
export const CityTypeRequest = (idList: string) => {
  return request.get<any, ProvinceReturnAryType>(
    `/admin/cmn/dict/findByParentId/${idList}`
  );
};
// 4.请求医院详细信息
export const HospitalDetailsRequest = (idList: string) => {
  return request.get<any, HospitalDetailsType>(
    `/admin/hosp/hospital/show/${idList}`
  );
};
// 5.发送状态码更改状态
export const ChangeStatusRequest = (id: string, status: 0 | 1) => {
  return request.get<any, null>(
    `/admin/hosp/hospital/updateStatus/${id}/${status}`
  );
};
//6. 获取分页列表
export const getPageListRequest = (hoscode: string) => {
  return request.get<any, getPageListType>(`/admin/hosp/department/${hoscode}`);
};
// 7.某个科室的详细排班时间请求
export const DetailedTimeRequest = ({
  page,
  limit,
  hoscode,
  depcode,
}: fourDateType) => {
  return request.get<any, getTimeType>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`
  );
};
// 8.获取某个科室吗某个时间具体详情
export const findScheduleListRequest = ({
  hoscode,
  depcode,
  workDate,
}: accordingToTime) => {
  return request.get<any, accordingToTimeType>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  );
};
